import config from "@/config/config";
function rem() {
  const docEl: any = document.documentElement;
  const resizeEvt =
    "orientationchange" in window ? "orientationchange" : "resize";
  // var _this = this;
  const reFn = function () {
    const clientWidth = docEl.clientWidth;
    let width;
    if (clientWidth < 750) {
      width = clientWidth;
      docEl.style.fontSize = 100 * (width / 750) + "px";
      config.isPhone = true;
    } else {
      docEl.style.fontSize = "";
      config.isPhone = false;
    }
    console.log(config.isPhone);
  };
  reFn();
  window.addEventListener(resizeEvt, reFn, false);
  document.addEventListener("DOMContentLoaded", reFn, false);
}

export default rem;
